package net.ojbk.jiaofu.service;

import java.io.IOException;

import org.apache.commons.lang3.ArrayUtils;

import net.ojbk.jiaofu.util.StringTool;
import net.ojbk.util.ExcelTool;

public class collectService {

	public static String collectTask(String userId, String taskId, int taskType, String[] basebasicInfo, String[] extraInfo) {
		// 创建数据库连接
		StudentService.updateTaskSubmit(taskId, userId);
		// 判断taskType 确定是否需要求改 Excel
			// 通过 basebasicInfo 、 extraInfo
		// 设置为完成
		if(taskType==3)
		{
			String[] info = (String[]) ArrayUtils.addAll(basebasicInfo, extraInfo);
			
			Object[][] data = new Object[1][info.length];
			data[0]=info;
			try {
				ExcelTool.addOneData(data, TaskService.getExcelPath(userId, taskId));
			} catch (IOException e) {
				e.printStackTrace();
			}
		}

		
		// 关闭数据路链接
		return "true"; //  返回
	}
	
}
